<%@ include file="/taglibs.jsp" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<head>
	<link href="../../../css/index_style.css" rel="stylesheet" type="text/css" />

	<!-- 打开友情链接-->
	<script type="text/javascript">
		function mbar(sobj) {
			var docurl = sobj.options[sobj.selectedIndex].value;
			if (docurl != "") {
				open(docurl, '_blank');
				sobj.selectedIndex = 0;
				sobj.blur();
			}
		}
		</script>
	
	<!-- 获得验证码 -->
	<SCRIPT type=text/javascript>
	function change() {
		var randomnumber = Math.random();
		document.getElementById("yanzhengmatu").src = "yanzhengma.jsp?a="+randomnumber;
	}
	</SCRIPT>
	
	<!-- 表单验证 -->
	<script type="text/javascript">
	String.prototype.trim = function()
	{
	  return this.replace(/(^\s*)|(\s*$)/g, "");
	}
	
	function check() {
		   var userid = document.form1.userid.value.toString();
		   var password = document.form1.password.value.toString();
		   var yanzhengma = document.form1.yanzhengma.value.toString();
		   
 	   if(userid.trim().length == 0) {
		       alert('请输入用户账号！');
		       document.form1.userid.focus();
		       return false;
		       
		   } else if(password.trim().length == 0) {
		       alert('请输入密码！');
		       document.form1.password.focus();
		       return false;
		        
		   } else if(yanzhengma.trim().length == 0) {
		       alert('请输入验证码 ！');
		       document.form1.yanzhengma.focus();
		       return false;
		   } 
			
 	   	  	document.form1.submit();
		}
		
		var theTimer;
		var focusTabIndex = 4;
		
		function slideBy(){
			focusTabIndex = (focusTabIndex + 1) % 4;
			
			$('#news_tab_0').attr("class", "hideContent");
			$('#news_tab_1').attr("class", "hideContent");
			$('#news_tab_2').attr("class", "hideContent");
			$('#news_tab_3').attr("class", "hideContent");
			$('#news_tab_' + focusTabIndex).attr("class", "showContent");
			
			var picPath = $('#news_tab_pic_path_' + focusTabIndex).val();
			$('#index_news_content_img').attr("src", picPath);
			
			var data = $('#news_tab_pic_title_' + focusTabIndex).val();
			$('#index_news_content_text').text(data);
			
			var hidden_data = $('#news_tab_pic_title_hidden_' + focusTabIndex).val();
			$("#index_news_content_text").attr("title", hidden_data);
			
			var hrefLink = $('#news_item_title_' + focusTabIndex).attr('href');
			$("#index_news_content_text").attr("href", hrefLink);
			$("#index_news_content_img_link").attr("href", hrefLink);
				
			//var datatitle = $('#news_item_title_' + focusTabIndex).attr('title');
			//$("index_news_content_text").attr("title", datatitle);
			
		}
		
		$(function(){
			theTimer = setInterval(slideBy, 5000);
			focusTabIndex = 3;
			slideBy();
		});
		
		function news_mouse_over(newsId){
			focusTabIndex = newsId - 1;
			slideBy();
			
			window.clearInterval(theTimer);
		}
		
		function news_mouse_out(newsId){
			theTimer = setInterval(slideBy, 5000);
		}
		
		function openVideo(obj, categoryId){
			openwindow("${ctx}/VideoAction_playVideo?videopath=" + obj + "&categoryId=" + categoryId, "视频播放",440,370);
		}
	
		function openwindow(url,name,iWidth,iHeight){
			var url; //转向网页的地址;
			var name; //网页名称，可为空;
			var iWidth; //弹出窗口的宽度;
			var iHeight; //弹出窗口的高度;
			var iTop = (window.screen.availHeight-30-iHeight)/2; //获得窗口的垂直位置;
			var iLeft = (window.screen.availWidth-10-iWidth)/2; //获得窗口的水平位置;
			window.open(url,name,'height='+iHeight+',,innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');
		}
	</script>
	
</head>
<body>
<s:if test="#session.level == -1">
<div id="nav_bar">
    <img id="nav_bar_left" src="../../../styles/nav_bar_left.png" alt=""/>
    <div id="welcome_label">欢迎您,王东</div>
    <img id="nav_bar_seperator" src="../../../styles/nav_bar_seperator.png" alt=""/>
    <div id="nav_location">
        <img id="nav_bar_point" src="../../../styles/nav_bar_point.png" alt="" />
        <div id="nav_cur_location">当前位置：&nbsp;首页</div>
    </div>
    <img style="float:right; width:5px;" src="../../../styles/nav_bar_right.png" alt=""/>
    <a id="nav_logout" href="${ctx}/logoutAction">[安全退出]</a>
</div>
</s:if>

<div style="clear:both; height:5px;">&nbsp;</div>
<div style=" min-height:450px;">
<div id="index_left_column">
	<s:if test="#session.level == -1">
	<!-- 个人信息 -->
    <div id="index_personal_info">
        <div id="index_personal_info_title">
            <img src="../../../styles/index_login_title_img.png" alt=""/>
            <span>个人信息</span>
        </div>
        <div id="index_personal_info_content">
            <table border="0" cellspacing="0" cellpadding="0" width="193px" style="margin-left:12px; margin-top:8px; height:125px;">
            	<tr>
            		<td><span style="font-weight:bold;">姓名：</span>&nbsp;&nbsp;<span><s:property value="#session.session_user.studentName" /></span></td>
            	</tr>
                <tr>
            		<td><span style="font-weight:bold; ">所属支部：</span>&nbsp;&nbsp;<span><s:property value="#request.branchName" /></span></td>
            	</tr>
                <tr>
            		<td><span style="font-weight:bold;">上次登录时间：</span>&nbsp;&nbsp;<span><s:property value="#session.lalestLoginTime"/></span></td>
            	</tr>
                <tr>
            		<td><span style="font-weight:bold;">上次登录IP：</span>&nbsp;&nbsp;<span><s:property value="#session.lalestLoginIp"/></span></td>
            	</tr>
            </table>
        </div>
    </div>
    </s:if>
    <s:else>
    <!-- 登录框 -->
    <div style="height:31px; width:220px; border:solid #dddddd 1px; background:url('../../../images/block_title_bg.jpg');">
    	<img src="../../../images/index_login_title.jpg" alt="" style="margin-left:5px;" />
    </div>
    <form action="${ctx}/loginAction" method="post" name="form1" >
    <table id="loginPad" border="0" cellspacing="5" cellpadding="0" style="background-color:#fff2f2; border:solid 1px #dddddd; width:220px;">
    	<tr>
    		<td>用&nbsp;户&nbsp;名:</td>
            <td><input name="userid" type="text" value="" style="width:140px;" /></td>
    	</tr>
    	<tr>
    		<td>类&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别:</td>
            <td>
            	<select name="userstatus"  style="width:145px;">
                      <option value="1">学生</option>
                      <option value="2">管理员</option>
                </select>
            </td>		
    	</tr>
        <tr>
    		<td>密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码:</td>
            <td><input name="password" type="password" value="" style="width:140px;" /></td>
    	</tr>
        <tr>
    		<td>验&nbsp;证&nbsp;码:</td>
            <td>
            	<input name="yanzhengma" type="text" value="" style="width:70px; float:left;"/>
            	<a href="#" onclick="change();"><img id="yanzhengmatu" src="yanzhengma.jsp" style="width:60px; height:20px; margin:0px; float:left; margin-left:8px;"  alt="点击换一张"></a>
            </td>
    	</tr>
        <tr>
    		<td></td>
            <td><input type="image" src="${ctx}/images/index_login_btn.jpg"  style="border:0px; width:94px; height:24px; display:inline;"  onclick= "javascript:return check(); "></td>
    	</tr>
    </table>
    </form>
    </s:else>
    
    <div id="index_online_statistic">
        <div id="index_online_statistic_title">
            <span style="line-height:28px; font-weight:bold;">当前登录人数: 
            	<s:if test="#request.sessionCount==''||#request.sessionCount==null">
    				0
    			</s:if>
    			<s:else>
    				<s:property value="#request.sessionCount"/>
    			</s:else>
    			人
           </span>
        </div>
    </div>
    <div id="index_study_announce">
        <div id="index_study_announce_title">
            <img src="../../../styles/index_study_title_img.png" alt=""/>
            <span>学习公告</span>
            <a href="${ctx}/NoticeAction_notice">更多>></a>
        </div>
        <div id="index_study_announce_content">
				<marquee height="103" behavior="scroll" direction="up"
					scrollamount="2" onMouseOver="this.stop()"
					onMouseOut="this.start()">
					<ul>
						<s:iterator value="notices">
							<li><img src="../../../styles/li_icon.png" alt="" />
								<a  href="${ctx}/NoticeAction_viewNotice?id=<s:property value="id"/>"
									target="_blank" title="<s:property value="title"/>"> 
								 <s:if test="%{title.length()>15}">
										<s:property value="title.substring(0,15)+'...'" />
								</s:if> 
								<s:else>
										<s:property value="title" />
								</s:else> 
							  </a>
					      </li>
					  </s:iterator>
				</ul>
			</marquee>
        </div>
    </div>
</div>

<div id="index_middle_column">
    <div id="index_news">
        <div id="index_news_title">
            <img src="../../../styles/index_news_title_img.png" alt=""/>
            <span>图片新闻</span>
            <a href="${ctx}/PartyNews_pictureNews" >更多>></a>
        </div>
        <div id="index_news_content">
            <div id="left_part">
                <div id="index_news_content_img_area">
                    <a id="index_news_content_img_link" href="#"  title=''><img id="index_news_content_img" src="../../../styles/sample_news_1.jpg" alt=""/></a>
                </div>
                <div id="index_news_content_text_area">
                    <a id="index_news_content_text" href="#"  title=''>教育系统学习钱学森同志先进事迹座谈会召开</a>
                </div>
            </div>
            
            <div id="right_part">
            	<s:iterator value="pictureNews" status="st">
                  <div>
                  	 <div id="news_tab_<s:property value="#st.index"/>" class="hideContent" onmouseover="news_mouse_over('<s:property value="#st.index"/>')" onmouseout="news_mouse_out('<s:property value="#st.index"/>')">
                        <a id="news_item_title_<s:property value="#st.index"/>" href="${ctx}/PartyNews_viewNews?id=<s:property value="id"/>" target="_blank" title="<s:property value="title" /> " ><s:property value="getShortTitle(title)"/></a>
                        <div>
                            <s:property value="getShortContent(content,22)"/>&nbsp;&nbsp;<a href="${ctx }/PartyNews_viewNews?id=<s:property value="id"/>" target="_blank" title="<s:property value="title" /> ">查看详情&gt;&gt;</a>
                        	<input id="news_tab_pic_path_<s:property value="#st.index"/>" type="hidden" value="${ctx}<s:property value="picPath"/>" />
                        	<input id="news_tab_pic_title_<s:property value="#st.index"/>" type="hidden" value="<s:property value="getShortContent(title,35)"/>" />
                        	<input id="news_tab_pic_title_hidden_<s:property value="#st.index"/>" type="hidden" value="<s:property value="title" /> " />
                        </div>
                     </div>
                 </div>
                </s:iterator>
            </div>
        </div>
    </div>
</div>
<div id="index_right_column">
    <div id="index_links">
        <div id="index_links_title">
            <img src="../../../styles/index_links_title_img.png" alt="" />
            <span>友情链接</span>
        </div>
    </div>
    <div class="index_link_item" style="margin-top:10px;">
        <a href="http://dangxiao.zzb.bupt.cn/" target="_blank"><img src="../../../styles/outer_link_1.png" alt="红旗飘飘网上党课" /></a>
    </div>
    <div class="index_link_item" style="margin-top:6px;">
        <a href="http://www.bupt.edu.cn/" target="_blank"><img src="../../../styles/outer_link_2.png" alt="北京邮电大学"  /></a>
    </div>
    <div class="index_link_item" style="margin-top:6px;">
        <a href="http://www.zzb.bupt.cn/" target="_blank"><img src="../../../styles/outer_link_3.png" alt="北邮党委组织部" /></a>
    </div>
    <div class="index_link_item" style="margin-top:6px;">
        <a href="http://cpc.people.com.cn/" target="_blank"><img src="../../../styles/outer_link_4.png" alt="中共新闻网" /></a>
    </div>
    
    <select style="margin-top:6px;" onChange="javascript:mbar(this);">
		<option  value="" selected="selected">更多友情链接......</option>
		<option  value="http://www.bupt.edu.cn">北京邮电大学</option>
		<option  value="http://dangxiao.zzb.bupt.cn/">北邮红旗飘飘网上党校</option>
		<option  value="http://www.zzb.bupt.cn/">北邮党委组织部</option>
		<option  value="http://cpc.people.com.cn/">中共新闻网</option>
	</select>
</div>

<div style="clear:both; height:10px;">&nbsp;</div>
<div id="index_latest_videos">
    <div id="index_latest_videos_title">
        <img src="../../../styles/index_videos_title_img.png" alt="" />
        <span>最新视频</span>
        <a href="${ctx}/VideoAction_view">更多>></a>
    </div>
    <div id="index_latest_videos_content">
        <s:iterator value="#request.latestVideos">
        <table cellpadding="0" cellspacing="0" style="float:left; margin-left:10px; margin-top:15px; width:313px; height:102px;">
            <tr>
            	<td style="height:102px; width:147px; position:relative; display:block;">
            		<img src="${ctx }<s:property value='picPath' />" alt="最新视频" style="position:absolute; top:0; left:0; width:147px; height:102px; border:solid 1px #cccccc;"/>
                    <img src="../../../styles/video_player_layer.png" alt="" onclick="openVideo('<s:property value='videopath' />', '<s:property value='categoryId' />')" style="position:absolute; top:0; left:0; width:145px; height:100px; cursor:pointer;"/>
            	</td>
            	<td style="width:6px;">&nbsp;</td>
            	<td style=" width:160px; text-align:left; vertical-align:top;">
            		 <a href="#" title="<s:property value="name" />"  onclick="openVideo('<s:property value='videopath' />', '<s:property value='categoryId' />')" style="display:block; height:18px; font-weight:bold;">
                    	<s:if test="%{name.length()>12}">
                    		<s:property value="name.substring(0,12)+'...'" />
                    	</s:if>
                    	<s:else>
                    		<s:property value="name" />
                    	</s:else>
                    </a>
                    <span style="display:block; height:55px; word-break:break-all;'"><b>视频简介：</b>
                    	<s:if test="%{introduction!=null && introduction.length()>40}">
                    		<s:property value="introduction.substring(0,40)+'...'"/>
                    	</s:if>
                    	<s:else>
                    		<s:property value="introduction"/>
                    	</s:else>
                    </span>
                    <br/>
                    <span><b>上传时间：</b><s:property value="simpleUploadDate"/></span>
            	</td>
            </tr>
        </table>
        </s:iterator>
    </div>
</div>
</div>
</body>